<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>js最大值</title>
	<meta name="viewport" content="width=device-width,initial-scale=1.0">
</head>
<body>
	<script type="text/javascript">
		/*******数组降序**************/
		var a = new Array(3,5,7);
		a.sort(function(x,y){
			return y-x;
		})
		console.log(a[0]);

		/***********最大值***************/
		var d=Math.max(3,5,7);
		console.log(d);
		/***********冒泡法***************/
		var array = [3, 5, 7, 2, 1];
		var temp = 0;
		for (var i = 0; i < array.length; i++)
			{
				for (var j = 0; j < array.length - i; j++)
					{
						if (array[j] > array[j + 1])
							{
								temp = array[j + 1];
								array[j + 1] = array[j];
								array[j] = temp;
							}
					}
			}
		var e = array.length;
		console.log(array[e-1]);
		/*************三目运算符****************/
		 var ab=3;var ac=5; var ad=7;
		var f = ab>ac? (ab>ad? ab:ad):(ac>ad? ac:ad);
		console.log(f);
		/*************if else******************/
		var u=3;
		var v=5;
		var w=7;
		function zuida (){
			if (u>v) {
				if (u>w) {
					console.log(u);
				}else{console.log(w)}
			}else{
				if (v>w) {
					console.log(v);
				}else{console.log(w);}
			}
		}
	</script>
</body>
</html>